home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1991 January & February / rerun-1991-01-02.d64 / laser math (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  3KB  |  90 lines

  1. 10 rem---laser math - tony brantner
  2. 20 poke53280,0:poke53281,0:printchr$(8)chr$(142)
  3. 30 dimml(1,11),hi(4),an(3)
  4. 40 fora=0to1:forz=0to11:readml(a,z):next:next
  5. 50 tc=646:s1=54272:s2=s1+7:a=rnd(-ti)
  6. 60 tt$="[180][146][164][164]aser  [180][146][205][206][161]ath":fora=1to38:sp$=sp$+" ":next
  7. 70 fora=s1tos1+23:pokea,0:next:pokes1+24,15:gosub740:ht=0:ms=0
  8. 80 rem---new wave
  9. 90 print"[147]"tab(2)"[159]level"lv+1;tab(12)tt$;tab(31)"[159]speed"gs
  10. 100 cx=1:fora=1to4:cy=20+a:gosub480:print""mid$("[158][154]",a,1)sp$;:next
  11. 110 poketc,2:cy=21:forcx=4to34step10:gosub480:print"[162][162]":next
  12. 120 printtab(14)"[158]answer[182]":printtab(2)"hits  [146]     ";tab(27)"misses [146]    "
  13. 130 pn=0:fora=0to4:hi(a)=0:next:poke198,0
  14. 140 rem---new entry
  15. 150 mc=99:in$="":cy=22:cx=21:gosub480:print"     "
  16. 160 print""tab(13-len(str$(ht)))ht;tab(38-len(str$(ms)))ms
  17. 170 ifpn=20andht/20=int(ht/20)then360
  18. 180 rem---main
  19. 190 cy=22:cx=21+len(in$):gosub480:print"[209]"
  20. 200 mc=mc+1:ifmc<20thenfora=1to70:next:goto240
  21. 210 mc=gs*2:ifpn<20thenln=int(rnd(1)*4):ifhi(ln)=0thengosub540
  22. 220 gosub500:z=0:fora=0to3:ifhi(a)thenhi(a)=hi(a)+1:ifhi(a)>17thenz=1
  23. 230 next:ifzthen400
  24. 240 cy=22:cx=21+len(in$):gosub480:print" [157]";:geta$:z=len(in$)
  25. 250 ifa$=chr$(13)andzthen300
  26. 260 ifa$=chr$(20)andzthenin$=left$(in$,z-1):print"[157] ":goto190
  27. 270 ifa$<"0"ora$>"9"orz>3then190
  28. 280 in$=in$+a$:printa$:goto190
  29. 290 rem---check answer
  30. 300 ln=4:fora=0to3:ifhi(a)=0oran(a)<>val(in$)then320
  31. 310 ifhi(a)>hi(ln)thenln=a
  32. 320 next:ifln<4thengosub650:ht=ht+1:hi(ln)=0:goto150
  33. 330 pokes1+6,240:pokes1+1,6:pokes1+4,33:fora=1to200:next:pokes1+4,32
  34. 340 ms=ms+1:goto150
  35. 350 rem---advance
  36. 360 pokes1+6,248:pokes1+4,17:fora=1to12:pokes1+1,a*8:forz=1to70:next:next
  37. 370 pokes1+4,16:ifgs<9thengs=gs+1
  38. 380 z$="press any key to advance":gosub440:goto90
  39. 390 rem---end
  40. 400 pokes1+6,248:pokes1+4,33:fora=45to1step-.1:pokes1+1,a:next
  41. 410 pokes1+4,32:a=ht*2-ms:ifa<0thena=0
  42. 420 z$="final score:"+str$(a)+" - press any key":gosub440:goto70
  43. 430 rem---get key
  44. 440 cy=2:cx=(40-len(z$))/2:a=0:z=0:poke198,0
  45. 450 gosub480:poketc,4+z*3:printleft$(z$,a):a=a+1:ifa>len(z$)thena=0:z=1-z
  46. 460 geta$:on-(a$="")goto450:return
  47. 470 rem---plot
  48. 480 poke214,cy-1:print:printtab(cx);:return
  49. 490 rem---scroll
  50. 500 poke781,3:poke782,248:poke91,218:poke90,40:poke89,218:poke88,80
  51. 510 sys41964:poke781,3:poke782,248:poke91,6:poke90,40:poke89,6:poke88,80
  52. 520 sys41964:return
  53. 530 rem---new saucer
  54. 540 a=ml(ma/2,lv*4):n1=a+int(rnd(1)*(ml(ma/2,lv*4+1)-a+1))
  55. 550 a=ml(ma/2,lv*4+2):n2=a+int(rnd(1)*(ml(ma/2,lv*4+3)-a+1))
  56. 560 ifma=0thenan(ln)=n1+n2
  57. 570 ifma=1thena=n1+n2:an(ln)=n1:n1=a
  58. 580 ifma=2thenan(ln)=n1*n2
  59. 590 ifma=3thena=n1*n2:an(ln)=n2:n2=n1:n1=a
  60. 600 cx=1+ln*10:poketc,rnd(1)*13+2:print""tab(cx)left$(sp$,8)
  61. 610 printtab(cx)" [164][175][185][185][175][164] ":printtab(cx)"[206]"spc(6)"[205]":printtab(cx)"[163][183][184][178][178][146][184][183][163]"
  62. 620 print"[145][145]"tab(cx+1)right$(str$(n1),3)mid$("+-*/",ma+1,1)mid$(str$(n2),2)
  63. 630 hi(ln)=2:pn=pn+1:return
  64. 640 rem---explode
  65. 650 cy=20:cx=4+ln*10:gosub480:poketc,7:pokes1+6,240:pokes1+4,33
  66. 660 fora=20tohi(ln)+1step-1:pokes1+1,a*8:print"[172][187][145][157][157]";:next:pokes1+4,32
  67. 670 pokes2+5,26:pokes2+6,9:pokes2+4,128:pokes2+4,129:cy=hi(ln):cx=1+ln*10
  68. 680 fora=2to7:pokes2+1,40-a*4:gosub480:poketc,a
  69. 690 print"  [201][205][206][213]  ":printtab(cx)"-[195] [214][214] [195]-":printtab(cx)"  [203][206][205][202]  ":next
  70. 700 poke214,cy-1:print:fora=1to3:printtab(cx)left$(sp$,8):next
  71. 710 cy=20:cx=4+ln*10:gosub480
  72. 720 fora=20tohi(ln)+1step-1:print"  [145][157][157]";:next:return
  73. 730 rem---menu
  74. 740 print"[147]":cy=4:cx=12:gosub480:printtt$
  75. 750 cy=8:cx=8:gosub480:print"[150]select operation (1-4)"
  76. 760 print:printtab(11)"1 addition":printtab(11)"2 subtraction"
  77. 770 printtab(11)"3 multiplication":printtab(11)"4 division":cx=31:gosub480
  78. 780 z$="4":gosub840:ma=a-1
  79. 790 cy=16:cx=7:gosub480:print"[154]select skill level (1-3) ";
  80. 800 z$="3":gosub840:lv=a-1
  81. 810 cy=19:cx=6:gosub480:print"[153]select starting speed (1-9) ";
  82. 820 z$="9":gosub840:gs=a:return
  83. 830 rem---get number
  84. 840 poke198,0:poketc,1
  85. 850 print"[209][157]";:fora=1to50:next:print" [157]";:fora=1to50:next
  86. 860 geta$:ifa$<"1"ora$>z$then850
  87. 870 printa$:fora=1to300:next:a=val(a$):return
  88. 880 rem---level data
  89. 890 data1,9,1,9,10,20,10,20,50,99,50,99,1,4,1,12,5,8,3,12,9,12,5,12
  90.